var stepId = $CertusJsonAjax.getStepInstanceId();
var processId = $CertusJsonAjax.getProInstanceId();

$CertusFormAjax.ajax("findSingSps",{"processId":processId}, function(result){
    var data = result.data;
    $$scope.createUser = data.operateName;
    $$scope.signTime = data.signTime;
    $$scope.createTime = data.createTime;
    $$scope.comments = data.comments;
    $$scope.id = data.id;
    $$scope.opinionMsg = data.opinionMsg;
    $$scope.userId = data.operaterId;

    $CertusFormAjax.ajax('findScdules',{"userId":$$scope.userId},function (response) {
        var data = response.data;
        $$scope.typeId = data.typeId;
        $$scope.workTime = data.workTime;
        $$scope.onTimeMorning = data.onTimeMorning;
        $$scope.offTimeMorning = data.offTimeMorning;
        $$scope.deadlineMorning = data.deadlineMorning;
        $$scope.onTimeAfternoon = data.onTimeAfternoon;
        $$scope.offTimeAfternoon = data.offTimeAfternoon;
        $$scope.bcComments = data.comments;
    });
});

$(".agree").on('click',function () {
    var opinionMsg = $("#opinionMsg").val();
    // 开启
    var index = layer.load(1);
    $CertusFormAjax.ajax('agreeBQLC',{"processId":processId,
        "stepId":stepId,"opinionMsg":opinionMsg,"id":$$scope.id},function () {
        //关闭
        layer.close(index);
        layer.msg("审批成功");
        window.history.back();
    });
});

$(".rback").on('click',function () {
    var opinionMsg = $("#opinionMsg").val();
    $CertusFormAjax.ajax('rbackBQLC',{"processId":processId,
        "stepId":stepId,"opinionMsg":opinionMsg,"id":$$scope.id},function () {
        layer.msg("退回成功");
        window.history.back();
    });
});

$(".unagree").on('click',function () {
    var opinionMsg = $("#opinionMsg").val();
    $CertusFormAjax.ajax('unagreeBQLC',{"processId":processId,
        "stepId":stepId,"opinionMsg":opinionMsg,"id":$$scope.id},function () {
        layer.msg("审批成功");
        window.history.back();
    });
})